
var webpack = require('webpack');
var path = require("path");
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
module.exports = {
    entry: { index: path.join(__dirname, "./build/index.js"),
    main: path.join(__dirname, "./build/main.js")
     },
    output: {
        path:path.join(__dirname, "./dist"),
        filename: '[name].js',
        //chunkFilename: "[name].[hash:5].js",
        vendor: ['React', 'ReactDOM', 'AMUIReact'],
        // publicPath:'http://cdn.wdtruck.com/' cdn
    },
     module: {
        loaders: [
        {test: /\.scss$/, loader: "style!css!sass"},
        {
            test: /\.css$/,loader: 'style-loader!css-loader'}, 

            {
            test: /\.jsx?$/,
            loader: 'babel',
            exclude: /node_modules/,
            query: {
                presets: ['es2015', 'react']
            }
        }, {
            test: /\.(png|jpg)$/,loader: 'url-loader?name=img/[hash:8].[name].[ext]'}, 

            {
            test: /\.less$/,
            loader: 'style-loader!css-loader!less-loader'
        }, {
            test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
            loader: "url-loader?limit=10000&mimetype=application/font-woff"
        }, {
            test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
            loader: "file-loader"
        }],
        plugins: [
            new webpack.BannerPlugin('about:zhouzheng'),
            new webpack.ProvidePlugin({
                $: "jquery",
                jQuery: "jquery",
                "window.jQuery": "jquery"
            }),
            ["import", {
              style: 'css',  // 'less',
              libraryName: 'antd-mobile',
            }],
            

        ],

    },
    resolve: {
        //这里可以绝对路径
        root: '/',
        extensions: ['', '.js', '.json', '.less'],
        alias: {
            //别名引用
            maincss:path.join(__dirname, "./build/main.scss"),
        }
    },
    //忽略打包,单独引用
    // externals: {
    //     'react': 'React',
    //     'react-dom': 'ReactDOM',
    //     'amazeui-react': 'AMUIReact',
    //     // 'babel':'babel',
    // },
    //启用观察者模式webpack --watch
    watch: false,
}
